﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CN2P.Recommendations.Repository.Interfaces
{
    /*
    [ContractClassFor(typeof(IProductRecommendationRepository))]
    internal abstract class IProductRecommendationRepositoryContract : IProductRecommendationRepository
    {
        public bool IsInitialized
        {
            get { return default(bool); }
        }

        public IList<DomainModel.ProductReference> GetRecommendations(params string[] productIds)
        {
            Contract.Requires<TypeInitializationException>
                (
                    this.IsInitialized == true,
                    "You have to set the IsInitialized-property to true before calling any methods to express the repository has been initialized, correctly!"
                );

            Contract.Requires<ArgumentException>(
                productIds.Length > 0,
                "You mast pass at least one product ID parameter to the method!");

            Contract.Requires<ArgumentException>(
                Contract.ForAll<string>(productIds, s => !string.IsNullOrEmpty(s)),
                "You cannot pass empty product ID paramters to this method!");

            Contract.Ensures(Contract.Result<IList<DomainModel.ProductReference>>() != null,
                             "The method GetRecommendations() is not allowed to return an value that is NULL!");

            return default(List<DomainModel.ProductReference>);
        }

        public DomainModel.ProductRecommendation AddRecommendationTraversal(string fromProductId, string toProductId)
        {
            Contract.Requires<TypeInitializationException>
                 (
                     this.IsInitialized == true,
                     "You have to set the IsInitialized-property to true before calling any methods to express the repository has been initialized, correctly!"
                 );

            Contract.Requires<ArgumentException>
                (
                    !string.IsNullOrEmpty(fromProductId),
                    "The source product ID 'fromProductId' must not be null or empty!"
                );

            Contract.Requires<ArgumentException>
                (
                    !string.IsNullOrEmpty(toProductId),
                    "The target product ID 'toProductId' must not be null or empty!"
                );

            Contract.Requires<ArgumentException>
                (
                    fromProductId != toProductId,
                    "The source product ID 'fromProductId' and the target product ID 'toProductId' must not be the same!"
                );

            Contract.Ensures
                (
                    Contract.Result<DomainModel.ProductRecommendation>() != null,
                    "This method must return the product recommendation that has been added to the system!"
                );

            return default(DomainModel.ProductRecommendation);
        }

        public DomainModel.ProductReference SubmitProductRating(string productId, float rating)
        {
            Contract.Requires<TypeInitializationException>
                 (
                     this.IsInitialized == true,
                     "You have to set the IsInitialized-property to true before calling any methods to express the repository has been initialized, correctly!"
                 ); 
            
            Contract.Requires<ArgumentException>
                (
                    !string.IsNullOrEmpty(productId),
                    "You cannot pass empty or null for the parameter 'productId' to this method!"
                );

            Contract.Requires<ArgumentException>
                (
                    (rating >= 1) && (rating <= 99),
                    "The value for the parameter 'rating' must be between 1 and 99!"
                );

            Contract.Ensures
                (
                    Contract.Result<DomainModel.ProductReference>() != null,
                    "This method must not return a null value. The return-value must be the added/updated product reference!"
                );

            return default(DomainModel.ProductReference);
        }
    }
    */
}
